package com.lyl.controller;

import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lyl.domain.SysUserLog;
import com.lyl.model.Result;
import com.lyl.service.SysUserLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

/**
 * @author lylbell
 * @date 2021-06-24 15:31
 */
@RestController
@Api(tags = "日志管理")
@RequestMapping("/sysUserLog")
public class SysUserLogController {


    @Autowired
    private SysUserLogService sysUserLogService;

    @GetMapping
    @ApiOperation(value="分页查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "current",value = "当前页"),
            @ApiImplicitParam(name = "size",value = "每页显示条数"),
    })
    public Result<Page<SysUserLog>> findByPage(@ApiIgnore Page<SysUserLog> page) {
        page.addOrder(OrderItem.desc("created"));
        Page<SysUserLog> userLogPage = sysUserLogService.page(page);
        return Result.ok(userLogPage);
    }
}
